Skip to content

Conversation

@ruck94301
Copy link
Contributor

Benefits:

  • expose/hide all at once
  • easily find sister panels instead of frames
  • avoids having many frames, all of different custom size.
  • easy to exit all at one click

From Google AI Overview,
wxpython convert app from a design of many independent dialogs to a design of tabs in a single window

https://www.google.com/search?client=safari&rls=en&q=wxpython+convert+app+from+a+design+of+many+independent+dialogs+to+a+design+of+tabs+in+a+single+window&ie=UTF-8&oe=UTF-8&dlnr=1&sei=9tCMaIybCoS7qtsP5J3roQ4

"To convert a wxPython app from multiple independent dialogs to a single-window tabbed design, you will refactor your dialogs into wx.Panel subclasses and embed them in a wx.Notebook or wx.aui.AuiNotebook. This approach is a standard pattern for creating modern, single-window interfaces in wxPython."

Google AI Overview also produces a step-by-step roadmap.

1. import wx.aui
2. create a MainFrame and its notebook (with InitialPanel instead of old InitialWindow).
3. For 4 classes, chg
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
(f) display_window method, change panel from new Panel obj to self
4. For 4 classes, ensure the calls to the class constructors ...
(a) pass notebook instead of title.
(b) add a call to AddPage, with the title.
benign add a newline
For 4 Window(wx.Frame) classes, imported from gui_analyzer, and
used from gui_main,
1. In gui_analyzer, for 4 classes,
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
    super().__init__(parent)
    self.notebook = parent
(f) display_window method, change panel from new Panel obj to self
2. in gui_main, for 4 classes,
(a) fix the names in the import and
(b) call to constructor (from Window to Panel)
3. in gui_main,
(a) pass notebook instead of title.
(b) add a call to AddPage, with the title.
For 4 Window(wx.Frame) classes, imported from gui_categorizer, and
used from gui_main,
1. In gui_categorizer, for 4 classes,
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
    super().__init__(parent)
    self.notebook = parent
(f) display_window method, change panel from new Panel obj to self
2. in gui_main, for 4 classes,
(a) fix the names in the import and
(b) call to constructor (from Window to Panel)
3. in gui_main,
(a) pass notebook instead of title.
(b) add a call to AddPage, with the title.
For 3 Window(wx.Frame) classes, imported from gui_detector, and
used from gui_main,

1. In gui_detector, for classes,
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
    super().__init__(parent)
    self.notebook = parent
(f) display_window method, change panel from new Panel obj to self
2. in gui_main, for classes,
(a) fix the names in the import and
(b) call to constructor (from Window to Panel)
3. in gui_main,
(a) pass notebook instead of title.
(b) add a call to AddPage, with the title.
For 2 Window(wx.Frame) classes, imported from gui_preprocessor, and
used from gui_main,

1. In gui_preprocessor, for the classes,
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
    super().__init__(parent)
    self.notebook = parent
(f) display_window method, change panel from new Panel obj to self
2. in gui_main, for the classes,
(a) fix the names in the import and
(b) call to constructor (from Window to Panel)
3. in gui_main,
(a) pass notebook instead of title.
(b) add a call to AddPage, with the title.
For 2 Window(wx.Frame) classes in gui_categorizer only

1. In gui_categorizer, for the classes,
(a) from subclass of wx.Frame to subclass of wx.Panel
(b) from class named 'Window'... to class named 'Panel'
(c) __init__ args from title to parent
(d) __init__ call to super(), from complex to simpler form
(e) __init__ keep self.notebook = parent
    super().__init__(parent)
    self.notebook = parent
(f) display_window method, change panel from new Panel obj to self

2. in gui_categorizer
(a) fix name in call to constructor (from Window to Panel)
(b) pass notebook instead of title.
(c) add a call to AddPage, with the title.
@yujiahu415 yujiahu415 merged commit a1136e6 into umyelab:master Sep 3, 2025
4 checks passed
@ruck94301 ruck94301 deleted the wx_notebook_try2 branch September 3, 2025 17:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants